# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.OSPolicyResource do
  @moduledoc """
  An OS policy resource is used to define the desired state configuration and provides a specific functionality like installing/removing packages, executing a script etc. The system ensures that resources are always in their desired state by taking necessary actions if they have drifted from their desired state.

  ## Attributes

  *   `exec` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyResourceExecResource.t`, *default:* `nil`) - Exec resource
  *   `file` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyResourceFileResource.t`, *default:* `nil`) - File resource
  *   `id` (*type:* `String.t`, *default:* `nil`) - Required. The id of the resource with the following restrictions: * Must contain only lowercase letters, numbers, and hyphens. * Must start with a letter. * Must be between 1-63 characters. * Must end with a number or a letter. * Must be unique within the OS policy.
  *   `pkg` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyResourcePackageResource.t`, *default:* `nil`) - Package resource
  *   `repository` (*type:* `GoogleApi.OSConfig.V1.Model.OSPolicyResourceRepositoryResource.t`, *default:* `nil`) - Package repository resource
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :exec => GoogleApi.OSConfig.V1.Model.OSPolicyResourceExecResource.t() | nil,
          :file => GoogleApi.OSConfig.V1.Model.OSPolicyResourceFileResource.t() | nil,
          :id => String.t() | nil,
          :pkg => GoogleApi.OSConfig.V1.Model.OSPolicyResourcePackageResource.t() | nil,
          :repository => GoogleApi.OSConfig.V1.Model.OSPolicyResourceRepositoryResource.t() | nil
        }

  field(:exec, as: GoogleApi.OSConfig.V1.Model.OSPolicyResourceExecResource)
  field(:file, as: GoogleApi.OSConfig.V1.Model.OSPolicyResourceFileResource)
  field(:id)
  field(:pkg, as: GoogleApi.OSConfig.V1.Model.OSPolicyResourcePackageResource)
  field(:repository, as: GoogleApi.OSConfig.V1.Model.OSPolicyResourceRepositoryResource)
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyResource do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.OSPolicyResource.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.OSPolicyResource do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
